package com.hsmw.api.service;


import com.hsmw.api.mapper.HsmwDriverAnswerMapper;
import com.hsmw.api.mapper.HsmwDriverClassVideoMapper;
import com.hsmw.common.base.BaseService;
import com.htn.common.core.base.DataResponse;
import com.htn.common.core.utils.StringUtils;
import com.hsmw.domain.HsmwDriverAnswer;
import com.hsmw.domain.HsmwDriverClassVideo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class HsmwDriverClassVideoService extends BaseService<HsmwDriverClassVideoMapper, HsmwDriverClassVideo> {

    @Autowired
    private HsmwDriverClassVideoMapper hsmwDriverClassVideoMapper;


    public DataResponse saveOrUpdateVideo(HsmwDriverClassVideo hsmwDriverClassVideo) {

        if(StringUtils.isNotBlank(hsmwDriverClassVideo.getId())){
            hsmwDriverClassVideoMapper.updateById(hsmwDriverClassVideo);
        }else {
            hsmwDriverClassVideoMapper.insert(hsmwDriverClassVideo);
        }


        return new DataResponse();
    }
}
